import request from "@/utils/request";

import { baseUrlConfig } from "@/config/config";
const basePath = baseUrlConfig.processBaseUrl;

// 事件上报列表
export const getEventReportList = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/find/page",
    method: "post",
    data,
  });
};
// 事件类型
export const getEventType = () => {
  return request({
    url: basePath + "/event/eventType/top",
    method: "post",
  });
};
// 事件上报列表导出
export const eventExport = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/export",
    method: "post",
    responseType: "blob",
    data,
  });
};
// 事件上报列表导入
export const eventImport = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/import",
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data,
  });
};
// 模板下载
export const exportTemplate = () => {
  return request({
    url: basePath + "/event/eventReport/exportTemplate",
    method: "get",
    responseType: "blob",
  });
};
// 新增事件上报
export const addEventReport = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/append",
    method: "post",
    data,
  });
};
// 编辑事件上报
export const updateEventReport = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/update",
    method: "post",
    data,
  });
};
// 事件回退 事件响应
export const eventReport = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/approve",
    method: "post",
    data,
  });
};
// 获取上报信息
export const reportInfo = (id: string) => {
  return request({
    url: basePath + `/event/eventReport/info/${id}`,
    method: "get",
  });
};
// 获取退回和响应信息
export const approveInfo = (data: any) => {
  return request({
    url: basePath + "/event/eventReport/approveList",
    method: "post",
    data,
  });
};
// 获取事件类型
export const getTree = () => {
  return request({
    url: basePath + "/event/eventType/tree",
    method: "post",
    data: {},
  });
};
// 获取样例图
export const exportSampleImage = () => {
  return request({
    url: basePath + "/event/eventReport/exportSampleImage",
    method: "get",
    responseType: "blob",
  });
};
// 后果/影响
export const getConsequence = (data: any) => {
  return request({
    url: basePath + "/event/eventInfo/find",
    method: "post",
    data,
  });
};
